home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.amiga.programmer
- Path: dd.chalmers.se!news.chalmers.se!sunic!trane.uninett.no!eunet.no!EU.net!sun4nl!sci.kun.nl!severus.mbfys.kun.nl!rhialto
- From: rhialto@mbfys.kun.nl (Olaf Seibert)
- Subject: Re: Removing Task started with CreateNewProc
- Message-ID: <Co5Cvx.8I2@sci.kun.nl>
- Sender: news@sci.kun.nl (News owner)
- Nntp-Posting-Host: severus.mbfys.kun.nl
- Organization: University of Nijmegen, The Netherlands
- References: <rknopCo3z57.Azo@netcom.com>
- Date: Tue, 12 Apr 1994 12:47:56 GMT
- Lines: 30
-
- In <rknopCo3z57.Azo@netcom.com> rknop@netcom.com (Robert Knop) writes:
- >I have a parent process that creates a child process with the dos.library
- >CreateNewProc, using the NP_Entry tag (as opposed to the NP_SegList tag).
- >When I want to finish the task, the parent process sends a message to the
- >child process, telling it to clean up. The child process cleans up
- >_everything_ it has allocated, and then does:
- >
- >ReplyMsg(msg);
- >Wait(0L);
- >
- >When the parent process gets the reply to the "clean up" message, it takes
- >that to mean that the child process is cleaned up and ready to be killed, so
- >it calls RemTask(childprocess).
-
- First, I would add a Forbid() before the ReplyMsg(), so that the parent
- can't possibly see the reply before the child has terminated.
-
- Second, since it is a DOS *Process*, you can't just call RemTask() on it.
- The best way is to have it fall of the edge of the world, in this
- case, to let it return from the function you initially started.
- It will do the cleanup as is judged necessary by the CreateNewProc()
- function.
- This also works for Tasks, by the way. In practice, there is rarely
- need to RemTask() another Task.
-
- >-Rob Knop
- -Olaf.
- --
- ___ Olaf 'Rhialto' Seibert rhialto@mbfys.kun.nl
- \X/ An original idea. That can't be too hard. The library must be full of them.
-